// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import router from './router'
import store from './vuex/index'
import axios from './axios/index'
import newDirective from '@/assets/js/directives.js' //引入自定义指令文件
import globalVariable from '@/assets/js/global_variable.js' //引入全局变量文件
//第一种方式引入less
import less from 'less'
Vue.use(less)
//使用ElementUI
Vue.use(ElementUI);

//挂载全局变量（在vue文件里直接通过this.global.xxx 获取）
Vue.prototype.global = globalVariable;

Vue.prototype.$axios = axios

// 设置为 false 以阻止 vue 在启动时生成生产提示。
Vue.config.productionTip = false

//全局注册自定义指令
for (let item in newDirective) {
  Vue.directive(item, newDirective[item]);
}

/* eslint-disable no-new */
const vm =
  new Vue({
    el: '#app',
    router,
    store,
    axios,
    components: { App },
    template: '<App/>',
    beforeCreate() {
      //绑定全局事件总线
      Vue.prototype.$bus = this;
    }
  })
// console.log(Vue);
// console.dir(Vue)
console.log(vm);
